<template>
  <div class="class-schedule">
    <!-- 搜索部分 -->
    <header class="header-search">
      <div class="search">
        <div>
          <div>
            <span class="span_text">学年学期：</span>
            <el-select
              v-model="searchParams.termValue"
              clearable
              size="mini"
              placeholder="请选择学年学期"
              style="width: 150px"
              @change="handleChange('term')"
            >
              <el-option
                v-for="item in termOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>

          <div>
            <span class="span_text">教学周：</span>
            <el-select
              v-model="searchParams.weeksValue"
              clearable
              size="mini"
              placeholder="请选择教学周"
              style="width: 150px"
              @change="handleChange('weeks')"
            >
              <el-option
                v-for="item in weeksOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
          <el-button
            @click="handleSearch(false)"
            type="primary"
            size="small"
            style="margin-left: 15px"
          >
            查询
          </el-button>
          <el-button
            type="primary"
            size="small"
            @click="handleExportClass"
            style="margin-left: 15px"
            >导出课表</el-button
          >
        </div>
      </div>
      <!-- <div>
          <span class="span_text">班级：</span>
          <el-select
            v-model="searchParams.classValue"
            clearable
            placeholder="请选择班级"
            style="width: 240px"
          >
            <el-option
              v-for="item in classOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </div> -->
    </header>

    <div>
      <div class="class_time_header">
        <div class="class_date">
          <span class="date_title" v-if="tableHeaderData.week.week_name"
            >{{ tableHeaderData.week.week_name }} 课表</span
          >

          <span v-if="tableHeaderData.week.start_time"
            >({{ tableHeaderData.week.start_time }} ~
            {{ tableHeaderData.week.end_time }})</span
          >
        </div>
      </div>

      <div class="time_table">
        <el-table
          class="video_table"
          :data="listData"
          border
          max-height="600"
          style="width: 100%"
        >
          <el-table-column
            prop="section"
            label="节次"
            min-width="130"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <div class="class_section">
                <span>{{ scope.row.section_name }}</span>
                <span>{{ scope.row.section_time }}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="monday"
            min-width="130"
            :label="'周一' + formatTime(tableHeaderData.week_data[0].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[0].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.monday">
                <div class="section_header" v-show="false">
                  <span
                    @click="selectedCourse(scope.row.monday, 'monday', true)"
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>

                  <span
                    @click="selectedCourse(scope.row.monday, 'monday', false)"
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[0].date,
                        'monday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'monday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>
                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.monday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.monday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.monday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.monday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[0].date,
                }"
                v-else
                @click="
                  tableHeaderData.week_data[0].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[0].date,
                      'monday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="tuesday"
            min-width="130"
            :label="'周二' + formatTime(tableHeaderData.week_data[1].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[1].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.tuesday">
                <div class="section_header" v-show="false">
                  <span
                    @click="selectedCourse(scope.row.tuesday, 'tuesday', true)"
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="selectedCourse(scope.row.tuesday, 'tuesday', false)"
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[1].date,
                        'tuesday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'tuesday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.tuesday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.tuesday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.tuesday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.tuesday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                v-else
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[1].date,
                }"
                @click="
                  tableHeaderData.week_data[1].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[1].date,
                      'tuesday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="wednesday"
            min-width="130"
            :label="'周三' + formatTime(tableHeaderData.week_data[2].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[2].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.wednesday">
                <div class="section_header" v-show="false">
                  <span
                    @click="
                      selectedCourse(scope.row.wednesday, 'wednesday', true)
                    "
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="
                      selectedCourse(scope.row.wednesday, 'wednesday', false)
                    "
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[2].date,
                        'wednesday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'wednesday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.wednesday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.wednesday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.wednesday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.wednesday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                v-else
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[2].date,
                }"
                @click="
                  tableHeaderData.week_data[2].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[2].date,
                      'wednesday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="thursday"
            min-width="130"
            :label="'周四' + formatTime(tableHeaderData.week_data[3].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[3].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.thursday">
                <div class="section_header" v-show="false">
                  <span
                    @click="
                      selectedCourse(scope.row.thursday, 'thursday', true)
                    "
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="
                      selectedCourse(scope.row.thursday, 'thursday', false)
                    "
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[3].date,
                        'thursday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'thursday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.thursday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.thursday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.thursday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.thursday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[3].date,
                }"
                v-else
                @click="
                  tableHeaderData.week_data[3].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[3].date,
                      'thursday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="friday"
            min-width="130"
            :label="'周五' + formatTime(tableHeaderData.week_data[4].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[4].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.friday">
                <div class="section_header" v-show="false">
                  <span
                    @click="selectedCourse(scope.row.friday, 'friday', true)"
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="selectedCourse(scope.row.friday, 'friday', false)"
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[4].date,
                        'friday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'friday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.friday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.friday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.friday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.friday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[4].date,
                }"
                v-else
                @click="
                  tableHeaderData.week_data[4].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[4].date,
                      'friday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="saturday"
            min-width="130"
            :label="'周六' + formatTime(tableHeaderData.week_data[5].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[5].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.saturday">
                <div class="section_header" v-show="false">
                  <span
                    @click="
                      selectedCourse(scope.row.saturday, 'saturday', true)
                    "
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="
                      selectedCourse(scope.row.saturday, 'saturday', false)
                    "
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[5].date,
                        'saturday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'saturday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.saturday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.saturday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.saturday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.saturday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                v-else
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[5].date,
                }"
                @click="
                  tableHeaderData.week_data[5].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[5].date,
                      'saturday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="sunday"
            min-width="130"
            :label="'周日' + formatTime(tableHeaderData.week_data[6].date)"
            align="center"
            show-overflow-tooltip
            :class-name="
              !tableHeaderData.week_data[6].date ? 'disable_col' : ''
            "
          >
            <template slot-scope="scope">
              <div class="class_course" v-if="scope.row.sunday">
                <div class="section_header" v-show="false">
                  <span
                    @click="selectedCourse(scope.row.sunday, 'sunday', true)"
                  >
                    <img
                      src="../../assets/images/ai/transfer_class.png"
                      alt=""
                      title="调课"
                    />
                  </span>
                  <span
                    @click="selectedCourse(scope.row.sunday, 'sunday', false)"
                  >
                    <img
                      src="../../assets/images/ai/replace_class.png"
                      alt=""
                      title="代课"
                    />
                  </span>
                  <span
                    @click="
                      handleCellClick(
                        scope.row,
                        tableHeaderData.week_data[6].date,
                        'sunday',
                        true
                      )
                    "
                  >
                    <img
                      src="../../assets/images/ai/edit_class.png"
                      alt=""
                      title="编辑"
                    />
                  </span>
                  <span @click="handleDeleteCourse(scope.row, 'sunday')">
                    <img
                      src="../../assets/images/ai/del_class.png"
                      alt=""
                      title="删除"
                    />
                  </span>
                </div>

                <div class="section_info">
                  <div>
                    <img src="../../assets/images/ai/class.png" alt="" />
                    <span> {{ scope.row.sunday.subject_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/tea.png" alt="" />
                    <span>{{ scope.row.sunday.teacher_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/ring.png" alt="" />
                    <span>{{ scope.row.sunday.classroom_name }}</span>
                  </div>

                  <div>
                    <img src="../../assets/images/ai/camera.png" alt="" />
                    <span> {{ scope.row.sunday.live_status_str }}</span>
                  </div>
                </div>
              </div>
              <span
                class="class_add"
                v-show="false"
                :class="{
                  disable_add: !tableHeaderData.week_data[6].date,
                }"
                v-else
                @click="
                  tableHeaderData.week_data[6].date &&
                    handleCellClick(
                      scope.row,
                      tableHeaderData.week_data[6].date,
                      'sunday',
                      false
                    )
                "
              >
                +
              </span>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 新增编辑课程弹窗 -->
      <el-dialog
        :visible.sync="courseModal"
        width="600px"
        :title="title"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        center
      >
        <el-form
          class="course"
          ref="form"
          :rules="courseRule"
          :model="courseForm"
          label-width="100px"
          label-position="left"
        >
          <el-form-item label="学科" prop="subject_id">
            <el-select
              v-model="courseForm.subject_id"
              placeholder="请选择学科"
              clearable
              :disabled="isEdit"
            >
              <el-option
                v-for="item in subjectOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>

          <el-form-item label="授课老师" prop="teacher_id">
            <el-select
              v-model="courseForm.teacher_id"
              placeholder="请选择授课老师"
              clearable
              :disabled="isEdit"
            >
              <el-option
                v-for="item in teacherOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>

          <el-form-item label="上课场地" prop="classroom_id">
            <el-cascader
              :disabled="isEdit"
              style="width: 90%"
              v-model="courseForm.classroom_id"
              :options="siteOptions"
              :props="{ expandTrigger: 'hover' }"
            ></el-cascader>
          </el-form-item>

          <el-form-item label="直录播设置" prop="live_status">
            <el-radio-group
              v-model="courseForm.live_status"
              @change="handleChangeLiveStatus"
            >
              <el-radio :label="1">开启</el-radio>
              <el-radio :label="0">关闭</el-radio>
            </el-radio-group>

            <span class="recorded_tip">(开启后自动创建预约直播) </span>
          </el-form-item>

          <el-form-item
            v-if="courseForm.live_status"
            label="录播设备"
            prop="recorder_id"
          >
            <el-select
              v-model="courseForm.recorder_id"
              placeholder="请选择录播设备"
              clearable
            >
              <el-option
                v-for="item in recorderOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-form>

        <span slot="footer">
          <el-button @click="handleCancel">取 消</el-button>
          <el-button type="primary" @click="handleConfirm">确 定</el-button>
        </span>
      </el-dialog>

      <!-- 调课代课弹窗 -->
      <el-dialog
        width="610px"
        :visible.sync="adjustmentModal"
        :title="adjustmentTitle"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
      >
        <el-form
          class="course"
          ref="moveForm"
          :rules="adjustmentRule"
          :model="adjustmentForm"
          :label-width="isType ? '60px' : '100px'"
          label-position="left"
        >
          <!-- 调课 -->
          <div v-if="isType">
            <el-form-item label="原课" prop="originCourse">
              <div class="adjustment_course">
                <el-select
                  class="adjustment_select"
                  v-model="adjustmentForm.originCourse.week"
                  clearable
                  :disabled="adjustmentModal"
                >
                  <el-option
                    v-for="item in dateOptions"
                    :label="item.label"
                    :value="item.value"
                    :key="item.value"
                  ></el-option>
                </el-select>

                <el-select
                  v-model="adjustmentForm.originCourse.subject_id"
                  clearable
                  :disabled="adjustmentModal"
                >
                  <el-option
                    v-for="item in subjectOptions"
                    :key="item.value"
                    :label="
                      item.value === adjustmentForm.originCourse.subject_id
                        ? `第${numberToText(
                            adjustmentForm.originCourse.section
                          )}节 ${item.label}`
                        : item.label
                    "
                    :value="item.value"
                  />
                </el-select>
              </div>
            </el-form-item>

            <el-form-item label="调课" prop="adjustmentSection">
              <div class="adjustment_course">
                <el-select
                  class="adjustment_select"
                  v-model="adjustmentForm.adjustmentWeek"
                  placeholder="请选择调课时间"
                  clearable
                >
                  <el-option
                    v-for="item in dateOptions"
                    :label="item.label"
                    :value="item.value"
                    :key="item.value"
                  ></el-option>
                </el-select>

                <el-select
                  v-model="adjustmentForm.adjustmentSection"
                  placeholder="请选择节次"
                  clearable
                >
                  <el-option
                    v-for="item in sectionData"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </div>
            </el-form-item>
          </div>

          <!-- 代课 -->
          <div v-else>
            <el-form-item label="课程" prop="originCourse">
              <div class="adjustment_course">
                <el-select
                  class="adjustment_select"
                  v-model="adjustmentForm.originCourse.week"
                  clearable
                  :disabled="adjustmentModal"
                >
                  <el-option
                    v-for="item in dateOptions"
                    :label="item.label"
                    :value="item.value"
                    :key="item.value"
                  ></el-option>
                </el-select>

                <el-select
                  v-model="adjustmentForm.originCourse.subject_id"
                  clearable
                  :disabled="adjustmentModal"
                >
                  <el-option
                    v-for="item in subjectOptions"
                    :key="item.value"
                    :label="
                      item.value === adjustmentForm.originCourse.subject_id
                        ? `第${numberToText(
                            adjustmentForm.originCourse.section
                          )}节 ${item.label}`
                        : item.label
                    "
                    :value="item.value"
                  />
                </el-select>
              </div>
            </el-form-item>

            <el-form-item label="原授课老师">
              <el-select
                class="adjustment_select"
                v-model="adjustmentForm.originCourse.teacher_id"
                placeholder="请选择授课老师"
                clearable
                :disabled="!isType"
              >
                <el-option
                  v-for="item in teacherOptions"
                  :label="item.label"
                  :value="item.value"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="代课老师" prop="takeTeacher_id">
              <el-select
                class="adjustment_select"
                v-model="adjustmentForm.takeTeacher_id"
                placeholder="请选择授课老师"
                clearable
              >
                <el-option
                  v-for="item in teacherOptions"
                  :label="item.label"
                  :value="item.value"
                  :key="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </div>

          <el-form-item label="通知" prop="notice">
            <el-radio-group v-model="adjustmentForm.notice">
              <el-radio :label="1">开启</el-radio>
              <el-radio :label="0">关闭</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>

        <span slot="footer">
          <el-button @click="handleCancelAdjustmentModal">取 消</el-button>
          <el-button type="primary" @click="selectedCourseConfirm"
            >确 定</el-button
          >
        </span>
      </el-dialog>
    </div>
  </div>
</template>
<script>
// 枚举星期
const enumDateWeek = {
  1: "周一",
  2: "周二",
  3: "周三",
  4: "周四",
  5: "周五",
  6: "周六",
  7: "周日",
};

const mockData = {
  term: {},
  week: {},
  week_data: [{}, {}, {}, {}, {}, {}, {}],
};

// 枚举日期
const enumDate = {
  monday: 1,
  tuesday: 2,
  wednesday: 3,
  thursday: 4,
  friday: 5,
  saturday: 6,
  sunday: 7,
};

// 根据number枚举日期
const enmuDateText = {
  1: "monday",
  2: "tuesday",
  3: "wednesday",
  4: "thursday",
  5: "friday",
  6: "saturday",
  7: "sunday",
};

import { deepClone, longTimeMessage } from "@/tools/tool.js";
export default {
  data() {
    return {
      sectionData: [], //节次
      // 课程内容
      courseForm: {
        subject_id: "", // 学科
        teacher_id: "", // 授课老师
        classroom_id: "", // 上课场地
        live_status: 0, // 直录播设置
        recorder_id: "", // 录播设备
      },
      // 调代课内容
      adjustmentForm: {
        originCourse: {
          subject_id: "",
        }, // 原课
        adjustmentWeek: "", // 周几
        adjustmentSection: "", // 节次
        notice: 0, // 通知
        takeTeacher_id: "", // 代课老师
      },
      dateOptions: [], // 周选项
      title: "添加课程", // 新增编辑弹窗的title
      adjustmentTitle: "调课", // 调代课弹窗的title
      courseModal: false, // 添加编辑弹窗
      adjustmentModal: false, // 调代课弹窗
      isType: false, // fasle代课 true调课
      isEdit: false, // 是否处于编辑状态
      listData: [], // 单周课表
      courseRule: {
        subject_id: [
          { required: true, message: "请选择学科", trigger: "change" },
        ],
        teacher_id: [
          { required: true, message: "请选择授课老师", trigger: "change" },
        ],
        classroom_id: [
          { required: true, message: "请选择上课场地", trigger: "change" },
        ],
        live_status: [
          { required: true, message: "请选择直录播设置", trigger: "change" },
        ],
        recorder_id: [
          { required: true, message: "请选择录播设备", trigger: "change" },
        ],
      },
      adjustmentRule: {
        adjustmentSection: [
          { required: true, message: "请选择节次", trigger: "change" },
        ],
        adjustmentWeek: [
          { required: true, message: "请选择时间", trigger: "change" },
        ],
        originCourse: [
          { required: true, message: "请选择上课场地", trigger: "change" },
        ],
        notice: [
          { required: true, message: "请选择是否开启通知", trigger: "change" },
        ],
        takeTeacher_id: [
          { required: true, message: "请选择代课老师", trigger: "change" },
        ],
      },
      selectInfo: {
        section: "", // 节
        day: "", // 天
        weeks: "", // 周
      }, // 记录当前添加/修改的课程的周以及天信息 包含第几周 星期几 第几节课
      termOptions: [], // 学期选项
      weeksOptions: [], //周选项
      classOptions: [], //班级选项
      searchParams: {
        termValue: "",
        weeksValue: "",
        classValue: "",
      }, // 查询参数
      teacherOptions: [], // 教师选项
      subjectOptions: [], // 学科选项
      recorderOptions: [], // 录播设备选项
      siteOptions: [], // 场地选项
      tableHeaderData: mockData, //课表表头数据
    };
  },

  computed: {
    // 格式化整理时间日期
    formatTime() {
      return (day) => {
        if (day) {
          const match = day.match(/\-/); // 匹配第一个点
          if (match) {
            // 截取字符串
            const dayText = day.substring(match.index + 1);
            return `(${dayText})`;
          }
        } else {
          return "";
        }
      };
    },

    // 转节次为中文
    numberToText() {
      return (num) => {
        const numberMap = {
          0: "零",
          1: "一",
          2: "二",
          3: "三",
          4: "四",
          5: "五",
          6: "六",
          7: "七",
          8: "八",
          9: "九",
        };

        const unitMap = {
          1: "", // 十的话特殊处理
          2: "十",
          3: "百",
          4: "千",
        };

        const numStr = num.toString();
        let text = "";

        for (let i = 0; i < numStr.length; i++) {
          const digit = parseInt(numStr[i]);
          const unit = numStr.length - i; // 计算位数

          if (digit !== 0) {
            if (unit === 2 && digit === 1 && i === 0) {
              text += unitMap[unit]; // 处理“十”的情况
            } else {
              text += numberMap[digit] + unitMap[unit];
            }
          } else {
            // 处理零的情况，避免出现“一十零一”这样的情况
            if (unit === 2 && numStr.length > 1 && numStr[i + 1] !== "0") {
              text += numberMap[digit];
            }
          }
        }

        return text;
      };
    },
  },

  methods: {
    // 直播状态改变
    handleChangeLiveStatus() {
      this.courseForm.recorder_id = "";
    },
    // 周一到周日的课程 单周课表
    generateSingleClassData() {
      const singleWeek = [];
      this.sectionData.forEach((item) => {
        const sigleData = {
          section: item.section,
          monday: "",
          tuesday: "",
          wednesday: "",
          thursday: "",
          friday: "",
          saturday: "",
          sunday: "",
          ...item,
        };
        singleWeek.push(sigleData);
      });

      return singleWeek;
    },

    // 处理Listdata数据
    formatListData(listData) {
      const transWeekCourse = [];
      const tableColum = this.generateSingleClassData();

      if (listData.length) {
        // 将对应的星期数据赋值给制定的字段
        const weekCourse = listData.reduce((acc, curr) => {
          const foundIndex = acc.findIndex(
            (item) => item.section === curr.section
          );
          if (foundIndex !== -1) {
            const key = enmuDateText[curr.week];
            acc[foundIndex][key] = curr;
            acc[foundIndex].sectionTime = {
              start_time: curr.start_time,
              end_time: curr.end_time,
            };
          }
          return acc;
        }, tableColum);

        return weekCourse;
      } else {
        return tableColum;
      }
    },

    // 添加编辑取消
    handleCancel() {
      // 重置数据
      this.$refs.form.resetFields();
      this.courseModal = false;
    },

    // 调课代课弹窗取消
    handleCancelAdjustmentModal() {
      // 重置数据

      this.$nextTick(() => {
        this.$refs.moveForm.resetFields();
      });
      this.adjustmentForm.adjustmentWeek = "";
      this.adjustmentModal = false;
    },

    // 添加编辑确定
    async handleConfirm() {
      await this.$refs.form.validate((valid) => {
        if (valid) {
          const { section, day, date } = this.selectInfo;
          const { courseForm } = this;
          this.setClasstableValue(
            {
              section,
              date,
            },
            day,
            courseForm
          );
        }
      });
    },

    // 单元格被点击
    handleCellClick(row, date, column, status) {
      this.courseModal = true;
      this.title = status ? "编辑课程" : "添加课程";
      this.isEdit = status;
      const selectInfo = {
        section: row.section,
        day: column,
        date,
      };

      //编辑回显数据 新增为空数据
      if (status) {
        if (!row[column].recorder_id) row[column].recorder_id = "";
        this.courseForm = deepClone(row[column]);
      }

      Object.assign(this.selectInfo, selectInfo);
    },

    // 调代课确定
    async selectedCourseConfirm() {
      await this.$refs.moveForm.validate((valid) => {
        if (valid) {
          const {
            takeTeacher_id,
            originCourse,
            notice,
            adjustmentSection,
            adjustmentWeek,
          } = this.adjustmentForm;

          // fasle代课 true调课
          if (this.isType) {
            const params = {
              syllabus_id1: originCourse.id,
              is_message: notice,
              week: adjustmentWeek,
              section: adjustmentSection,
            };

            const moveCourseInfo = {
              week: adjustmentWeek,
              section: adjustmentSection,
            };

            // 查找调的时间、节次是否已经有了课程
            const adjusementCourse =
              this.listData[adjustmentSection - 1][
                enmuDateText[adjustmentWeek]
              ];

            // 调已有的课
            if (adjusementCourse) {
              params.syllabus_id2 = adjusementCourse.id;
              params.start_time = adjusementCourse.start_time;
              params.end_time = adjusementCourse.end_time;
            } else {
              // 调没有的课
              // 获取节开始时间 没有日期只有时间
              const sectionItemData = this.sectionData.find(
                (item) => item.section == adjustmentSection
              );

              // 获取日期
              const adjustmentDate = this.tableHeaderData.week_data.find(
                (item) => item.date_num == adjustmentWeek
              );
              params.start_time = `${adjustmentDate.date} ${sectionItemData.start_time}`;
              params.end_time = `${adjustmentDate.date} ${sectionItemData.end_time}`;
              params.syllabus_id2 = 0;
            }

            const success = (res) => {
              if (res.status === "success") {
                this.$message.success(res.msg);
                this.getList();
                this.handleCancelAdjustmentModal();
              } else {
                this.$message.error(res.msg);
              }
            };

            const fail = (res) => {
              longTimeMessage(this, res, 5000);
            };
            this.$ajax.put("api/school/syllabusChangeTime", params, {
              func: { success, fail },
            });
          } else {
            const params = {
              is_message: notice,
              syllabus_id: originCourse.id,
              teacher_id: takeTeacher_id,
            };

            const success = (res) => {
              if (res.status) {
                this.$message.success(res.msg);
                this.getList();
                this.handleCancelAdjustmentModal();
              } else {
                this.$message.error(res.msg);
              }
            };
            const fail = (res) => {
              longTimeMessage(this, res, 5000);
            };
            this.$ajax.put("api/school/syllabusChangeUser", params, {
              func: { success, fail },
            });
          }
        }
      });
    },

    // 调课 代课
    selectedCourse(originData, date, type) {
      this.adjustmentModal = true;
      this.isType = type;
      this.adjustmentTitle = type ? "调课" : "代课";
      console.info(originData, date, type);
      this.adjustmentForm.originCourse = originData;
    },

    // 赋值课程数据
    setClasstableValue(row, label, value) {
      console.info(row, label, value, this.isEdit);

      const { classValue, termValue } = this.searchParams;
      const {
        live_status,
        recorder_id,
        subject_id,
        teacher_id,
        classroom_id,
        id,
      } = this.courseForm;
      console.info(classroom_id, this.courseForm);
      if (this.isEdit) {
        const params = {
          syllabus_id: id,
          teacher_id: teacher_id,
          subject_id: subject_id,
          live_status: live_status,
          recorder_id: recorder_id,
          classroom_id: classroom_id,
        };

        const success = (res) => {
          const { status } = res;
          if (status === "success") {
            this.$message.success(res.msg);
            this.getList();
            this.handleCancel();
          } else {
            this.$message.error(res.msg);
          }
        };

        const fail = (res) => {
          longTimeMessage(this, res, 5000);
        };

        this.$ajax.put("api/school/syllabus", params, {
          func: { success, fail },
        });
      } else {
        const sectionItem = this.sectionData.find(
          (item) => item.section == row.section
        );
        console.log("班级id", $store.getters.userInfo.class.i);
        const params = {
          term_id: termValue,
          class_id: $store.getters.userInfo.class.id,
          teacher_id: teacher_id,
          subject_id: subject_id,
          recorder_id: recorder_id,
          classroom_id: classroom_id[classroom_id.length - 1],
          section: row.section,
          week: enumDate[label],
          live_status: live_status,
          start_time: `${row.date} ${sectionItem.start_time}`,
          end_time: `${row.date} ${sectionItem.end_time}`,
        };

        const success = (res) => {
          const { status } = res;
          if (status === "success") {
            this.$message.success(res.msg);
            this.getList();
            this.handleCancel();
          } else {
            this.$message.error(res.msg);
          }
        };

        const fail = (res) => {
          longTimeMessage(this, res, 5000);
        };
        this.$ajax.post("api/school/syllabus", params, {
          func: { success, fail },
        });
      }
    },

    // 删除课程
    handleDeleteCourse(rowDate, column) {
      this.$alert(
        "确定删除此课程？删除后，预约的直播数据以及视频也会自动删除掉。请谨慎操作",
        "删除",
        {
          confirmButtonText: "确定",
          showCancelButton: true,
          cancelButtonText: "取消",
          callback: (action) => {
            // todo 删除操作
            if (action === "confirm") {
              const params = {
                syllabus_id: rowDate[column].id,
              };

              const success = (res) => {
                if (res.status === "success") {
                  this.$message.success(res.msg);
                  this.getList();
                } else {
                  this.$message.error(res.msg);
                }
              };
              const fail = (res) => {
                this.$message.error(res.msg);
              };
              this.$ajax.delete("api/school/syllabus", {
                params,
                func: { success, fail },
              });
            }
          },
        }
      );
    },

    init() {
      this.getTimeSet();
      this.getClassSite();
      this.getTermOption();
      this.getTeacherOption();
    },

    // 获取节次
    getTimeSet() {
      const success = (res) => {
        const { status, data } = res;
        if (status == "success") {
          this.sectionData = data.map((item) => {
            return {
              ...item,
              value: item.section,
              label: item.section_name,
            };
          });
        }
      };
      this.$ajax.get("api/school/timeset", {
        params: {},
        func: { success: success },
      });
    },

    // 获取学期选项
    getTermOption() {
      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.termOptions = data.map((item) => {
            return {
              value: item.id,
              label: `${item.start_year}-${item.semester_name}`,
              ...item,
            };
          });

          // 默认选中第一个
          this.searchParams.termValue = this.termOptions[0].value || "";
          this.getWeeksOption();
        }
      };

      this.$ajax.get("api/term/term_list", { func: { success } });
    },

    // 获取周选项
    getWeeksOption() {
      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.weeksOptions = data.map((item) => {
            const { week_name, week_num } = item;
            return {
              value: week_num,
              label: week_name,
              ...item,
            };
          });
          this.handleSearch(true);
        }
      };
      const params = {
        term_id: this.searchParams.termValue,
      };
      this.$ajax.get("api/term/getTermWeekTimeList", {
        params,
        func: { success },
      });
    },

    // 选择器value变化
    handleChange(type) {
      switch (type) {
        case "term":
          if (this.searchParams.termValue) {
            this.getWeeksOption();
          } else {
            this.weeksOptions = [];
            this.searchParams.weeksValue = "";
          }
          break;
        case "weeks":
          break;
      }
    },

    // 查询
    handleSearch(isInit) {
      this.searchParams.classValue = sessionStorage.getItem("classId");
      this.getDateAndWeek(isInit);
    },

    getList() {
      const { classValue, weeksValue } = this.searchParams;
      if (!weeksValue) return this.$message.error("请选择教学周");
      if (!classValue) return this.$message.error("请选择班级");
      const weeks = this.weeksOptions.find(
        (item) => item.week_num === weeksValue
      );
      const params = {
        class_id: classValue,
        start_time: weeks.start_time,
        end_time: weeks.end_time,
      };

      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.listData = this.formatListData(data);
        }
      };
      this.$ajax.get("api/school/syllabus", {
        params,
        func: { success },
      });
    },

    // 导出课表
    handleExportClass() {
      const { classValue, weeksValue } = this.searchParams;

      if (!classValue || !weeksValue) {
        return this.$message.error("请选择查询参数");
      }

      const weeks = this.weeksOptions.find(
        (item) => item.week_num === weeksValue
      );
      const params = {
        class_id: classValue,
        start_time: weeks.start_time,
        end_time: weeks.end_time,
      };

      const termName = this.termOptions.find(
        (item) => item.value === this.searchParams.termValue
      ).label;
      const weekName = this.tableHeaderData.week.week_name;
      const className = this.classOptions.find(
        (item) => item.value === this.searchParams.classValue
      ).label;

      const exportName = `${termName} ${className} ${weekName}课表`;

      this.export_excel("api/school/syllabusExport", params, exportName);
    },

    // 清空课表
    handleResetClass() {
      const { weeksValue } = this.searchParams;

      if (!weeksValue) {
        return this.$message.error("请选择清空的教学周");
      }

      const success = (res) => {
        if (res.status === "success") {
          this.$message.success(res.msg);
          this.getList();
        } else {
          this.$message.error(res.msg);
        }
        // 获取列表
      };
      const weeks = this.weeksOptions.find(
        (item) => item.week_num === weeksValue
      );
      const params = {
        start_time: weeks.start_time,
        end_time: weeks.end_time,
      };
      const fail = (res) => {
        this.$message.error(res.msg);
      };
      this.$ajax.delete("api/school/syllabusClearWeek", {
        params,
        func: { success, fail },
      });
    },

    // 获取设备
    getDeviceInfo() {
      const success = (res) => {
        this.recorderOptions = res.data.map((item) => {
          return {
            value: item.id,
            label: item.name,
          };
        });
      };
      const params = {
        class_id: this.searchParams.classValue,
      };
      this.$ajax.get("api/recorder/recorder_list", {
        params,
        func: { success },
      });
    },

    // 获取教师选项
    getTeacherOption() {
      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.teacherOptions = data.map((item) => {
            return {
              value: item.id,
              label: item.name,
            };
          });
        }
      };
      const params = {
        role_id: 6,
        status: 1,
      };
      this.$ajax.get("api/user/user", { params, func: { success } });
    },

    // 获取科目选项
    getSubjectOption() {
      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.subjectOptions = data.map((item) => {
            return {
              value: item.id,
              label: item.name,
            };
          });
        }
      };
      const gradeItem = this.classOptions.find(
        (item) => item.value == this.searchParams.classValue
      );
      const params = {
        org_id: gradeItem.grade_id,
        status: 1,
        type: 2,
      };
      this.$ajax.get("api/cate/subject", { params, func: { success } });
    },

    // 获取场地选项
    getClassSite() {
      const success = (res) => {
        this.siteOptions = this.addLabelToTree(res.data);
      };
      this.$ajax.get("api/school/inspection_data", { func: { success } });
    },

    // 场地选项添加上label和value
    addLabelToTree(data) {
      data.forEach((item) => {
        item.label = item.name;
        item.value = item.id;
        if (item.children && item.children.length > 0) {
          this.addLabelToTree(item.children); // 递归调用
        }
      });
      return data;
    },

    // 获取周时间、以及学期 判断当前时间是否超过了学期结束时间 如果没有过则定位到当前周，如果已过则定位到第一周
    getDateAndWeek(isInit) {
      const termData =
        this.termOptions.find(
          (item) => item.id === this.searchParams.termValue
        ) || {};
      const params = {};
      console.log("isInit===", isInit);
      if (isInit) {
        const termEnd = new Date(termData.end_time);
        const termStart = new Date(termData.start_time);
        const nowDate = new Date(this.handleDateFormat());

        // 当前学期是否开始
        if (termStart < nowDate) {
          // 已开始
          if (nowDate < termEnd) {
            // 在当前学期内
            params.select_time = "";
          } else {
            // 已结束 默认选中第一个
            this.searchParams.weeksValue = this.weeksOptions[0].value || "";
            const weeks = this.weeksOptions.find(
              (item) => item.week_num === this.searchParams.weeksValue
            );
            params.select_time = weeks.start_time;
          }
        } else {
          // 未开始 默认选中第一个
          this.searchParams.weeksValue = this.weeksOptions[0].value || "";
          const weeks = this.weeksOptions.find(
            (item) => item.week_num === this.searchParams.weeksValue
          );
          params.select_time = weeks.start_time;
        }
      } else {
        const { classValue, weeksValue } = this.searchParams;
        if (!weeksValue) return this.$message.error("请选择教学周");
        if (!classValue) return this.$message.error("请选择班级");
        const weeks = this.weeksOptions.find(
          (item) => item.week_num === weeksValue
        );
        params.select_time = weeks.start_time;
      }

      const success = (res) => {
        const { status, data } = res;
        if (status === "success") {
          this.searchParams.weeksValue = data.week.week_num || "";

          const transData = this.tranWeeksData(data);
          // 表头日期
          this.tableHeaderData = transData;

          // 选项日期
          this.dateOptions = data.week_data
            .filter((item) => item.date_num)
            .map((item) => {
              return {
                value: Number(item.date_num),
                label: enumDateWeek[item.date_num],
              };
            });

          this.getList();
          this.getDeviceInfo();
        }
      };
      this.$ajax.get("api/term/getNowTermWeekTime", {
        params,
        func: { success },
      });
    },

    // 获取当前日期时间
    handleDateFormat() {
      const date = new Date();
      // 获取年、月、日
      const year = date.getFullYear();
      let month = date.getMonth() + 1; // 月份是从0开始计数的，所以要加1
      let day = date.getDate();

      // 如果月份或日期是单个数字，则在前面补0
      month = month < 10 ? "0" + month : month;
      day = day < 10 ? "0" + day : day;

      return year + "-" + month + "-" + day;
    },

    // 转换一下weeks数据 有时开始的周不一定是星期一开始 需要补够七天
    tranWeeksData(originData) {
      const week_data = [];
      for (let i = 1; i <= 7; i++) {
        const findWeek = originData.week_data.find(
          (item) => item.date_num == i
        );
        if (findWeek) {
          week_data.push(findWeek);
        } else {
          week_data.push({});
        }
      }
      originData.week_data = week_data;
      return originData;
    },

    // 导入课表
    handleImprot() {
      this.$router.push("/affairs/period/class-timetable-import");
    },
  },

  created() {
    this.init();
  },
  mounted() {},
};
</script>
<style lang="scss">
.class-schedule {
  .el-dialog__body {
    padding: 30px 10px;
  }
}
.header-search {
  justify-content: space-between;
  align-items: center;

  .search {
    margin-right: 10px;
    div {
      display: flex;
      align-items: center;
      margin-right: 10px;
    }

    .span_text {
      width: 70px;
    }
  }

  .search_btn {
    display: flex;
    width: 270px;
  }
}

.class_time_header {
  display: flex;
  margin-top: 26px;
  justify-content: space-between;

  .class_date {
    display: flex;
    align-items: center;
    justify-content: center;

    .date_title {
      font-size: 20px;
      font-weight: bold;
      margin-right: 5px;
    }
  }
}

.video_table {
  margin-top: 10px;

  margin-left: 10px;
  margin-right: 10px;
  .class_section {
    display: flex;
    flex-direction: column;
  }

  .class_course {
    display: flex;
    flex-direction: column;

    .section_header {
      display: flex;
      justify-content: end;

      span {
        cursor: pointer;
        margin: 0 2px;

        img {
          width: 16px;
          height: 16px;
        }
      }
    }

    .section_info {
      margin-left: 8px;
      display: flex;
      flex-direction: column;
      align-items: baseline;

      div {
        display: flex;
        align-items: center;
        justify-content: center;
        img {
          width: 16px;
          height: 16px;
          margin-right: 5px;
        }
      }
    }
  }

  .class_add {
    font-size: 30px;
    color: #a4b4c7;
    cursor: pointer;
  }

  .disable_add {
    cursor: not-allowed;
  }
}

.eidit_info {
  height: 30px;
  border: 0;

  &:focus {
    border: 0 !important;
    outline: none !important; // 去除选中状态边框
  }
}

.time_table {
  display: flex;
  justify-content: center;
  align-items: center;

  td {
    width: 199px;
    height: 132px;
  }
}

.course_footer {
  display: flex;
}

.course {
  .recorded_tip {
    margin-left: 30px;
  }
}

.adjustment_course {
  display: flex;

  .adjustment_select {
    margin-right: 10px;
  }
}

.reset_btn {
  background-color: #c42e5f !important;
  border: none;
}

.el-table--enable-row-hover {
  & .el-table__body {
    tr:hover > td {
      background-color: inherit;
    }
  }
}

.disable_col {
  padding: 0 !important;
  background-color: #dddddd !important;
  cursor: not-allowed;
}
</style>
